package com.acme.bankapp.networking;

import java.io.IOException;
import java.net.Socket;

public abstract class Connection implements AutoCloseable{
    private Socket requestSocket;

    public Connection(Socket requestSocket) {
        this.requestSocket = requestSocket;
    }

    public Socket getRequestSocket() {
        return requestSocket;
    }

    public abstract Object read() throws IOException, ClassNotFoundException;

    public abstract void write(Object message) throws IOException;

    @Override
    public void close() throws IOException {
        requestSocket.close();
    }
}